package com.digitalchina.lxnsy.viewholder;

import android.view.ViewGroup;
import android.widget.TextView;

import com.digitalchina.lxnsy.R;
import com.digitalchina.lxnsy.entity.TechnologyVO;
import com.digitalchina.lxnsy.toolkit.TimeUtil;
import com.jude.easyrecyclerview.adapter.BaseViewHolder;

import java.text.MessageFormat;

/**
 * ================================================
 * 项目名称：BigData
 * 类描述：
 * 包名：com.digitalchina.bigdata.viewholder
 * 创建人：白彦东
 * 创建时间：2016/12/28 18:10
 * 修改备注：
 * ================================================
 */

public class QuestionHolder extends BaseViewHolder<TechnologyVO.QuestionBean> {

    private TextView tvQuestionTitle;
    private TextView tvQuestionCount;
    private TextView tvQuestionTime;


    public QuestionHolder(ViewGroup parent) {
        super(parent, R.layout.item_my_question);
        tvQuestionTitle = $(R.id.item_tv_question_title);
        tvQuestionCount = $(R.id.item_tv_question_count);
        tvQuestionTime = $(R.id.item_tv_question_time);
    }

    @Override
    public void setData(TechnologyVO.QuestionBean data) {
        super.setData(data);

        tvQuestionTitle.setText(data.getTitle() != null ? data.getTitle() : "");
        tvQuestionCount.setText(MessageFormat.format("{0}个回答", data.getAnswerCount()));
        tvQuestionTime.setText(TimeUtil.getDatebefore(data.getCreateTime() == null ? "" : data.getCreateTime()));
    }

}
